package Interface;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;

public class SetupPanel extends JFrame implements ActionListener {
	
	private  JLabel  lblRaw; 
	//private JTextField  txtraw;
	private JButton btnBackToMenu, btnNext;
	private Integer[] r={4,5,6,7,8};
	JComboBox rawlist = new JComboBox(r);
	private int raw=4;

	public SetupPanel () {
		
		rawlist.setSelectedIndex(0);
		rawlist.setBounds(172, 87, 57, 25);
		getContentPane().add(rawlist);
		rawlist.addActionListener(this); 
	
		
		btnBackToMenu = new JButton("Back To Menu");
		btnBackToMenu.setBounds(45, 215, 115, 25);
		getContentPane().add(btnBackToMenu);
		btnBackToMenu.addActionListener(this);
		
		btnNext = new JButton("Set");
		btnNext.setBounds(283, 215, 115, 25);
		getContentPane().add(btnNext);
		btnNext.addActionListener(this);
		
		setTitle("SetUp");
		this.setSize(436, 286);
		this.getContentPane().setLayout(null);
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		
		
		lblRaw = new JLabel("Select Raw Length");
		lblRaw.setBounds(63, 87, 97, 25);
		getContentPane().add(lblRaw);
		
		/*txtraw.setBounds(117, 74, 120, 20);
		getContentPane().add(txtraw);*/

		this.setVisible(true);
	}

	/*public void sendMessageForSetup() {
	}*/
	

	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		
		raw=(int)rawlist.getSelectedItem();
		
        if(e.getSource().equals(btnNext))
        {
        this.setVisible(false);
		JOptionPane.showMessageDialog(this,"The lot has: "+raw+" raws","OK",JOptionPane.INFORMATION_MESSAGE);
        }
        if(e.getSource() == btnBackToMenu)
        {
        	this.setVisible(false);
        	new WorkerGui();
        }
		
	}
	
	public int getsize()
	{
		return raw;
	}

}